package game;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL20;

import renderer.program.GLProgramManager;
import world.Camera;

public class M5CraftRenderer {
	public static void render() {
		Camera camera = WorldManager.getCamera();

/*		GLProgramManager.getBlockProgram().begin();
		{
			GL20.glUniformMatrix4(GLProgramManager.getBlockProgram().getCameraMatrixUniform(), false, camera.calcLookAtMatrix().toBuffer());
			GL20.glUniformMatrix4(GLProgramManager.getBlockProgram().getModelMatrixUniform(), false, WorldManager.getWorldMatix().toBuffer());
			WorldManager.renderWorld();
		}
		GLProgramManager.getBlockProgram().end();*/

		GLProgramManager.getBaseProgram().begin();
		{
			GL11.glDisable(GL11.GL_DEPTH_TEST);
			GL11.glDepthMask(false);
			WorldManager.renderCrosshair();
			GL11.glEnable(GL11.GL_DEPTH_TEST);
			GL11.glDepthMask(true);
		}
		GLProgramManager.getBaseProgram().end();

		GLProgramManager.getLineProgram().begin();
		{
			GL20.glUniformMatrix4(GLProgramManager.getLineProgram().getCameraMatrixUniform(), false, camera.calcLookAtMatrix().toBuffer());
			GL11.glLineWidth(2);
			WorldManager.renderCoordinator();
		}
		GLProgramManager.getLineProgram().end();
		
		WorldManager.renderWorld();
	}
}
